<!DOCTYPE html>
<html lang="en">
  <head>
<!--    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">-->
    <link rel="stylesheet" href="style.css">
    <link href='http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz:700' rel='stylesheet' type='text/css'>
    <title>Health Promotion</title>

        
  </head>

  <body id = "background">
       <?php
       include_once("category.php");
       include_once("question.php");
      ?>
<!--      <div style="height:120px">
          </div>-->
     
      <div id = "homepage">
            
          <table style ="float: left; width: 150px">
              
              <tr>
                  <td>
<!--                    <div id = "navigation">
            <div><a href="index_1.php">Dashboard</a></div>
            <div><a href="health.php">Health Promotions</a></div>
            <div><a href="charts.php">Questions And Answers</a></div>
            </div>  -->
                  </td>
                  
                 
                  </tr>
                  
          </table>
          
           <table>
                      <tr>
                  <!--<td style="background-color: yellow">g</td>-->
                  
                  <td>
                      <div id = "page"> 
                      <img src="Images/banner.jpg">
                      
                       <br>
                         <table style ="float: left; width: 230px">
              
              <tr>
                  <td>
                    <div id = "navigation">
             <div style="float: left; padding-left: 20px ">
                          <a class="mainMenu" href="index_1.php">Dashboard</a>
            <a class="mainMenu" href="health.php">Health Promotions</a>
            <a class="mainMenu" href="charts.php">Questions And Answers</a>
            
            </div>  
                  </td>
                  
                 
                  </tr>
                  
          </table>
                     
          <div class="formDiv">

            <form role="form">
                  <div class="col-lg-6" style="float: left">
              <div class="form-group">
                <label> Enter Question</label><br>
                <textarea class = "form-control" name = "question" rows="7" cols ="55"> </textarea>
<!--                <input class="form-control">-->
<!--                <p class="help-block">Example block-level help text here.</p>-->
              </div>
                

              <div class="form-group">
                <label>Choose a category</label>
                
                <?php
                $obj = new category();
                if(!$obj->get_all_categories())
                 {
                    echo"cannot find categories";
                 }
                 
                else
                 {
                    
                    echo"<select class='form-control' name='category'>";
                    $row = $obj->fetch();
                    $mane = "";
                    while ($row)
                      {
                      $name = ucfirst($row[name]);
                      echo "<option value=$row[cid]>$name</option>";
                      $row = $obj->fetch();
                 }
                    echo"</select>";
                 }
                ?>
              </div>


<!--              <button type="submit" class="btn btn-default">Submit</button>
              <button type="reset" class="btn btn-default">Reset</button>  -->

            </form>

          </div>
        </div>
       
                      </div>
                  </td>
              </tr>
                  </table>  
                   </div>
  </body>
</html>

<!--<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Forms - SB Admin</title>

     Bootstrap core CSS 
    <link href="css/bootstrap.css" rel="stylesheet">

     Add custom CSS here 
    <link href="css/sb-admin.css" rel="stylesheet">
    <link rel="stylesheet" href="font-awesome/css/font-awesome.min.css">
  </head>

  <body>
     
    <div id="wrapper">

       Sidebar 
      <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
         Brand and toggle get grouped for better mobile display 
        <div class="navbar-header">
          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="index.php">SB Admin</a>
        </div>

         Collect the nav links, forms, and other content for toggling 
        <div class="collapse navbar-collapse navbar-ex1-collapse">
          <ul class="nav navbar-nav side-nav">
            <li><a href="index.php"><i class="fa fa-dashboard"></i> Dashboard</a></li>
            <li><a href="health.php"><i class="fa fa-bar-chart-o"></i>Health Promotions</a></li>
            <li><a href="charts.php"><i class="fa fa-bar-chart-o"></i>Questions and Answers</a></li>
            <li><a href="tables.php"><i class="fa fa-table"></i> Tables</a></li>
            <li class="active"><a href="forms.php"><i class="fa fa-edit"></i> Forms</a></li>
            <li><a href="typography.php"><i class="fa fa-font"></i> Typography</a></li>
            <li><a href="bootstrap-elements.php"><i class="fa fa-desktop"></i> Bootstrap Elements</a></li>
            <li><a href="bootstrap-grid.php"><i class="fa fa-wrench"></i> Bootstrap Grid</a></li>
            <li><a href="blank-page.php"><i class="fa fa-file"></i> Blank Page</a></li>
            <li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-caret-square-o-down"></i> Dropdown <b class="caret"></b></a>
              <ul class="dropdown-menu">
                <li><a href="#">Dropdown Item</a></li>
                <li><a href="#">Another Item</a></li>
                <li><a href="#">Third Item</a></li>
                <li><a href="#">Last Item</a></li>
              </ul>
            </li>
          </ul>

          <ul class="nav navbar-nav navbar-right navbar-user">
            <li class="dropdown messages-dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-envelope"></i> Messages <span class="badge">7</span> <b class="caret"></b></a>
              <ul class="dropdown-menu">
                <li class="dropdown-header">7 New Messages</li>
                <li class="message-preview">
                  <a href="#">
                    <span class="avatar"><img src="http://placehold.it/50x50"></span>
                    <span class="name">John Smith:</span>
                    <span class="message">Hey there, I wanted to ask you something...</span>
                    <span class="time"><i class="fa fa-clock-o"></i> 4:34 PM</span>
                  </a>
                </li>
                <li class="divider"></li>
                <li class="message-preview">
                  <a href="#">
                    <span class="avatar"><img src="http://placehold.it/50x50"></span>
                    <span class="name">John Smith:</span>
                    <span class="message">Hey there, I wanted to ask you something...</span>
                    <span class="time"><i class="fa fa-clock-o"></i> 4:34 PM</span>
                  </a>
                </li>
                <li class="divider"></li>
                <li class="message-preview">
                  <a href="#">
                    <span class="avatar"><img src="http://placehold.it/50x50"></span>
                    <span class="name">John Smith:</span>
                    <span class="message">Hey there, I wanted to ask you something...</span>
                    <span class="time"><i class="fa fa-clock-o"></i> 4:34 PM</span>
                  </a>
                </li>
                <li class="divider"></li>
                <li><a href="#">View Inbox <span class="badge">7</span></a></li>
              </ul>
            </li>
            <li class="dropdown alerts-dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-bell"></i> Alerts <span class="badge">3</span> <b class="caret"></b></a>
              <ul class="dropdown-menu">
                <li><a href="#">Default <span class="label label-default">Default</span></a></li>
                <li><a href="#">Primary <span class="label label-primary">Primary</span></a></li>
                <li><a href="#">Success <span class="label label-success">Success</span></a></li>
                <li><a href="#">Info <span class="label label-info">Info</span></a></li>
                <li><a href="#">Warning <span class="label label-warning">Warning</span></a></li>
                <li><a href="#">Danger <span class="label label-danger">Danger</span></a></li>
                <li class="divider"></li>
                <li><a href="#">View All</a></li>
              </ul>
            </li>
            <li class="dropdown user-dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-user"></i> John Smith <b class="caret"></b></a>
              <ul class="dropdown-menu">
                <li><a href="#"><i class="fa fa-user"></i> Profile</a></li>
                <li><a href="#"><i class="fa fa-envelope"></i> Inbox <span class="badge">7</span></a></li>
                <li><a href="#"><i class="fa fa-gear"></i> Settings</a></li>
                <li class="divider"></li>
                <li><a href="#"><i class="fa fa-power-off"></i> Log Out</a></li>
              </ul>
            </li>
          </ul>
        </div> /.navbar-collapse 
      </nav>

      <div id="page-wrapper">

        <div class="row">
          <div class="col-lg-12">
            <h1>Questions and Answers <small>Ask a question</small></h1>
            <ol class="breadcrumb">
              <li><a href="index.php"><i class="fa fa-dashboard"></i> Dashboard</a></li>
              <li><a href="charts.php"><i class="fa fa-dashboard"></i>Questions and Answers</a></li>
              <li><a href="tables.php"><i class="fa fa-dashboard"></i>View Questions and Answers</a></li>
              <li class="active"><i class="fa fa-edit"></i> Questions and Answers</li>
            </ol>
            <div class="alert alert-info alert-dismissable">
              <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
             Ask a question to be answered by a specialist
            </div>
          </div>
        </div> /.row 

        <div class="row">
          <div class="col-lg-6">

            <form role="form">

              <div class="form-group">
                <label> Enter Question</label><br>
                <textarea class = "form-control" name = "question" rows="7" cols ="55"> </textarea>
                <input class="form-control">
                <p class="help-block">Example block-level help text here.</p>
              </div>
                

              <div class="form-group">
                <label>Choose a category</label>
                
                <?php
                $obj = new category();
                if(!$obj->get_all_categories())
                 {
                    echo"cannot find categories";
                 }
                 
                else
                 {
                    
                    echo"<select class='form-control' name='category'>";
                    $row = $obj->fetch();
                    $mane = "";
                    while ($row)
                      {
                      $name = ucfirst($row[name]);
                      echo "<option value=$row[cid]>$name</option>";
                      $row = $obj->fetch();
                 }
                    echo"</select>";
                 }
                ?>
              </div>


              <button type="submit" class="btn btn-default">Submit</button>
              <button type="reset" class="btn btn-default">Reset Button</button>  

            </form>

          </div>
        
        </div> /.row 

      </div><!-- /#page-wrapper 

    </div> /#wrapper 
    
    <?php
    if(isset($_POST))
    {
        if(isset($_REQUEST))
    {
        $cid = '';
        $name = "";
        if(isset($_REQUEST['category']))
        {
            $cid = $_REQUEST['category'];
        } 
        
        if(isset($_REQUEST['name']))
        {
            $name = $_REQUEST['name']; 
        }
        
        if(isset($_REQUEST['question']))
        {
          $question = new question();
        if(!$question->add_question('1',$cid,$_REQUEST['question']))
        {
//            print mysql_error();
            echo "cannot add";
        }  
        }
        
    }
    }
    
    ?>

     JavaScript 
    <script src="js/jquery-1.10.2.js"></script>
    <script src="js/bootstrap.js"></script>

  </body>
</html>-->